﻿using Sustainalytics.ClientDW.Entities;
using System;

namespace Sustainalytics.GCCS.Service
{
    public class GCOverallCompanySummaryDto
    {
        public Guid Id { get; set; }
        public GCCompanyProfileDto CompanyProfile { get; set; }
        public DateTime? GCSignatorySince { get; set; }
        public string GCSignatorySinceQuarter
        {
            get
            {
                var quarter = this.GCSignatorySince == null ? null : GCCSUtility.GetDefaultFormattedGccsQuarter(this.GCSignatorySince.Value);
                return quarter;
            }
        }
        public GCAssessment OverallCompanyAssessment { get; set; }
        public DateTime OverallCompanyAssessmentEffectiveSince { get; set; }
        public string OverallCompanyAssessmentEffectiveSinceQuarter
        {
            get
            {
                string quarter = GCCSUtility.GetDefaultFormattedGccsQuarter(this.OverallCompanyAssessmentEffectiveSince);
                return quarter;
            }
        }


        public virtual GCOverallCompanySummaryDto LoadFrom(GCOverallCompanySummary data)
        {
            this.Id = data.Id;            
            this.GCSignatorySince = data.GCSignatorySince;
            this.OverallCompanyAssessment = data.OverallCompanyAssessment;
            this.OverallCompanyAssessmentEffectiveSince = data.OverallCompanyAssessmentEffectiveSince;

            this.CompanyProfile = data.CompanyProfile == null ? null : new GCCompanyProfileDto().LoadFrom(data.CompanyProfile);

            return this;
        }
    }
}
